package com.atguigui.leetcode1;

import java.util.HashSet;

/**
 * 1015.可被 K 整除的最小整数
 * Project: leetcode
 * Package: com.atguigui.leetcode1
 * Version: 1.0
 * <p>
 * Created by WJX on 2023/5/10 10:17
 */
public class P1015SmallestIntegerDivisibleByK {
    public static void main(String[] args) {
        Solution solution = new P1015SmallestIntegerDivisibleByK().new Solution();
        // TO TEST
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public int smallestRepunitDivByK(int k) {
            var seen = new HashSet<Integer>();
            int x = 1 % k;
            while (x > 0 && seen.add(x))
                x = (x * 10 + 1) % k;
            return x > 0 ? -1 : seen.size() + 1;
        }
    }
}
